feat(a2a): upgrade a2a-sdk from >=0.3.4,<0.4 to >=1.0,<2 (A2A 1.0 spec)#5917
feat(a2a): upgrade a2a-sdk from >=0.3.4,<0.4 to >=1.0,<2 (A2A 1.0 spec)#5917waadarsh wants to merge 3 commits into
Conversation
Migrates all A2A integration code and tests from the Pydantic-based
a2a-sdk 0.3.x API to the Protocol Buffer (proto) based a2a-sdk 1.x
API, implementing the A2A 1.0 specification.
Breaking changes addressed:
- Part types: TextPart/DataPart/FilePart replaced by flat proto Part
with WhichOneof("content") oneof pattern (text, url, raw, data)
- Enum prefixes: TaskState.working -> TASK_STATE_WORKING,
Role.agent -> ROLE_AGENT (all enums now SCREAMING_SNAKE_CASE)
- Timestamps: TaskStatus.timestamp is now proto Timestamp
(use .FromDatetime() instead of .isoformat() string)
- TaskStatusUpdateEvent.final field removed; finality via task state
- AgentCard.url moved to supported_interfaces list (AgentInterface)
with protocolBinding + protocolVersion fields (A2A 1.0 schema)
- A2AStarletteApplication removed; replaced by create_agent_card_routes(),
create_jsonrpc_routes(), create_rest_routes() builders
- DefaultRequestHandler now requires agent_card= constructor argument
- ClientCallContext moved: a2a.client.middleware -> a2a.client.client
- ClientConfig.supported_transports -> supported_protocol_bindings
- TransportProtocol enum values now uppercase (JSONRPC, HTTP_JSON)
- Client send_message() takes SendMessageRequest proto and yields
StreamResponse (use .WhichOneof("payload") to dispatch)
- proto Struct metadata: use "in" + subscript instead of .get()
- AgentCard construction: use json_format.ParseDict() not **dict
- v1 SDK requires Task enqueued before TaskStatusUpdateEvent
Files changed: pyproject.toml, 16 source files, 15 test files
All 299 a2a unit + integration tests pass (2 skipped for removed
A2AFastAPIApplication which has no 1.x equivalent).
Fixes google#5056
Replace A2AFastAPIApplication (removed in a2a-sdk v1) with FastAPI + add_a2a_routes_to_fastapi in the two input_required follow-up tests. Also fix proto Task construction (remove 'kind' field, use Role.ROLE_USER enum). All 301 a2a tests now pass with 0 skipped.
f2273a3 to
5987e3f
Compare
🔍 ADK Pull Request Analysis: PR #5917Title: feat(a2a): upgrade a2a-sdk from >=0.3.4,<0.4 to >=1.0,<2 (A2A 1.0 spec) Executive Summary
Detailed Findings & Analysis1. Objectives & Impact ("What does it do?")
2. Justification & Value ("Is it a valid and useful change?")
3. Principle & Style Alignment Checklist ("Does it follow rules?")
Analysis Summary & ConclusionThe proposed PR is highly complete, fully compliant with ADK styling/architectural requirements, and ready for immediate merging. All Google CLA signatures have been verified and validated successfully. Under testing conditions, the modified code generates sound execution behaviors.
|
|
Hi @waadarsh , Thank you for your contribution! We appreciate you taking the time to submit this pull request. Can you please fix the failing mypy-diff tests before we can proceed with the review. |
- fix(check-file-contents): add AGENT_REGISTRY_MTLS_BASE_URL constant
alongside AGENT_REGISTRY_BASE_URL to satisfy googleapis.com mTLS policy
- fix(mypy): add type annotations to _part_metadata_get, _part_data_as_dict,
_extract_event_actions, _proto_metadata_to_dict; fix no-any-return in
_get_agent_card_url and _is_remote_response; fix arg-type in agent_to_a2a
- fix(proto): use HasField("message") instead of truthy check on proto
optional message fields in to_adk_event.py and remote_a2a_agent.py
- fix(tests): update test_remote_a2a_agent.py for a2a-sdk v1 proto API:
use A2AStreamResponse protos instead of tuples, real protos instead of
mocks, async generators for send_message, HasField-compatible assertions
- style: apply pyink/isort formatting to all modified files
e518f27 to
f578af0
Compare
|
Hi @rohityan, I've addressed all the CI failures:
All tests are passing locally. Ready for review when you get a chance! |
|
I will read the instructions for the The comprehensive findings have been logged into a premium, interactive analysis report artifact: 📜 analysis_results.mdHighlights of the Analysis
Recommendation: Approve this pull request. |
Summary
a2a-sdkdependency from>=0.3.4,<0.4to>=1.0,<2(A2A 1.0 spec)Fixes #5056
Key changes
Parttype:TextPart/DataPart/FilePart→ flat protoPartwithWhichOneof("content")TaskState.working→TASK_STATE_WORKING,Role.agent→ROLE_AGENTTaskStatus.timestamp: string.isoformat()→ protoTimestamp.FromDatetime()AgentCard.url→supported_interfaceslist withAgentInterface(A2A 1.0 schema)A2AStarletteApplication→create_agent_card_routes()/create_jsonrpc_routes()/create_rest_routes()DefaultRequestHandlernow requiresagent_card=argumentClientCallContext:a2a.client.middleware→a2a.client.clientsend_message()now takesSendMessageRequestproto and yieldsStreamResponse"in"+ subscript instead of.get()Taskenqueued beforeTaskStatusUpdateEventpart_metadatapropagation preserved from GenAI ↔ A2A part conversions.MOCK_FUNCTION_CALL_FOR_REQUIRED_USER_AUTHwithauth_requiredargs keyTest plan
add_a2a_routes_to_fastapi(v1 equivalent of removedA2AFastAPIApplication)mainafter branching (auth-required, part_metadata round-trips, type validation)